From: Alessandro Bono Date: Sun, 15 Jan 2023 15:34:38 +0000 (+0100) Subject: appDisplay: Don't assume this._placeholder always exists X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~405^2^2~171 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ec6ab60e62282e7ca59d0e8332bf946686499324;p=gnome-shell.git appDisplay: Don't assume this._placeholder always exists Dropping a icon from the dash to the application grid will set this._placeholder to null. However the AppIcon is still used to represent the application in the application grid. If we click on it we emit a pressed event. Stop assuming that this._placeholder is still valid in the callback, use the icon parameter instead. This fixes the following error: ``` Gjs-CRITICAL **: 18:22:39.003: JS ERROR: TypeError: this._placeholder is null _ensurePlaceholder/<@resource:///org/gnome/shell/ui/appDisplay.js:1477:17 vfunc_button_press_event@resource:///org/gnome/shell/ui/appDisplay.js:3121:27 ``` Fixes: 6fc93b78bc54763c0876951f2425fcfd96f61f00 Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6317 Part-of: --- diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 343f6fd81..abbadcbed 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -1473,9 +1473,9 @@ class AppDisplay extends BaseAppView { global.settings.is_writable('app-picker-layout'); this._placeholder = new AppIcon(app, { isDraggable }); - this._placeholder.connect('notify::pressed', () => { - if (this._placeholder.pressed) - this.updateDragFocus(this._placeholder); + this._placeholder.connect('notify::pressed', icon => { + if (icon.pressed) + this.updateDragFocus(icon); }); this._placeholder.scaleAndFade(); this._redisplay();